from modelscope import Qwen2_5_VLForConditionalGeneration, AutoTokenizer, AutoProcessor
from qwen_vl_utils import process_vision_info
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from transformers import pipeline
import torch
from tqdm import tqdm
import lora_test

test_path = "/home/ubuntu/rubbish/data/SENTI_ROBUST/test.tsv"
res = "index	prediction\n"

with open(test_path, 'r') as f:
    data = f.read().split('\n')[1:]
    for line in tqdm(data):
        if len(line) == 0:
            continue
        qid, text_a = tuple(line.split('\t'))
        label = lora_test.predict(text_a)
        res += f"{qid}\t{label}\n"

with open('SENTI_ROBUST.tsv', 'w') as f:
    f.write(res)

